The following table lists the elements used in IDL syntax used in the documentation on routines, functions, and objects:
Element |
Description |
[ ] (Square brackets) |
Indicates that the contents are optional. Do not include the brackets in your call. Brackets are also used when accessing arrays |
[ ] (Italicized square brackets) |
Indicates that the square brackets are part of the statement (used to define an array). |
Argument |
Arguments are shown in italics, and must be specified in the order listed. |
KEYWORD |
Keywords are all caps, and can be specified in any order. For functions, all arguments and keywords must be contained within parentheses. |
/KEYWORD |
Indicates a boolean keyword. |
Italics |
Indicates arguments, expressions, or statements for which you must provide values. |
{ } (Braces) |
|
| (Vertical lines) |
Separates multiple values or keywords. |
[, Value1, ... , Valuen] |
Indicates that any number of values can be specified. |
[, Value1, ... , Value8] |
Indicates the maximum number of values that can be specified. |
ROUTINE_NAME, Value1 [, Value2] [, Value3]: You must include Value1. You do not have to include Value2 or Value3. Value2 and Value3 can be specified independently.
ROUTINE_NAME, Value1 [, Value2, Value3]: You must include Value1. You do not have to include Value2 or Value3, but you must include both Value2 and Value3, or neither.
ROUTINE_NAME [, Value1 [, Value2]]: You can specify Value1 without specifying Value2, but if you specify Value2, you must also specify Value1.
Result = KRIG2D( Z [, X, Y] [, BOUNDS=[xmin, ymin, xmax, ymax]] )
An example of a valid statement is:
R = KRIG2D( Z, X, Y, BOUNDS=[0,0,1,1] )
READ_JPEG [, TRUE={1 | 2 | 3 }]
In this example, you must choose either 1, 2, or 3. An example of a valid statement is:
READ_JPEG, TRUE=1
Result = CVTTOBM( Array [, THRESHOLD=value{0 to 255}] )
An example of a valid statement is:
Result = CVTTOBM( A, THRESHOLD=150 )
[, LABEL=n{label every nth gridline}]
Do not include the braces or their content in your statement.
IDLprocedures use the following general syntax:
PROCEDURE_NAME, Argument [, Optional_Argument]
where PROCEDURE_NAME is the name of the procedure, Argument is a required parameter, and Optional_Argument is an optional parameter to the procedure.
IDLfunctions use the following general syntax:
Result = FUNCTION_NAME( Argument [, Optional_Argument] )
where Result is the returned value of the function, FUNCTION_NAME is the name of the function, Argument is a required parameter, and Optional_Argument is an optional parameter. Note that all arguments and keyword arguments to functions should be supplied within the parentheses that follow the function’s name.
Functions do not always have to be used in assignment statements (i.e., A=SIN(10.2)), they can be used just like any other IDL expression. For example, you could print the result of SIN(10.2) by entering the command:
PRINT, SIN(10.2)
The “Arguments” section describes each valid argument to the routine. Note that these arguments are positional parameters that must be supplied in the order indicated by the routine’s syntax.
Often, arguments that contain values upon return from the function or procedure (“output arguments”) are described as accepting “named variables”. A named variable is simply a valid IDL variable name. This variable does not need to be defined before being used as an output argument. Note, however that when an argument calls for a named variable, only a named variable can be used—sending an expression causes an error.
The “Keywords” section describes each valid keyword argument to the routine. Note that keyword arguments are formal parameters that can be supplied in any order.
Keyword arguments are supplied to IDL routines by including the keyword name followed by an equal sign (“=”) and the value to which the keyword should be set. The value can be a value, an expression, or a named variable (a named variable is simply a valid IDL variable name).
Note: If you set a keyword equal to an undefined named variable, IDL will quietly ignore the value.
For example, to produce a plot with diamond-shaped plotting symbols, the PSYM keyword should be set to 4 as follows:
PLOT, FINDGEN(10), PSYM=4
Note the following when specifying keywords:
In rare cases, a keyword’s default value is 1. In these cases, the syntax is listed as KEYWORD=0, as in SLIDE_IMAGE [, Image] [, CONGRID=0]. In this example, CONGRID is set to 1 by default. If you specify CONGRID=0, you can turn it back on by specifying either /CONGRID or CONGRID=1.
For example, the WIDGET_CONTROL procedure can return the user values of widgets in a named variable using the GET_UVALUE keyword. To return the user value for a widget ID (contained in the variable mywidget) in the variable userval, you would use the command:
WIDGET_CONTROL, mywidget, GET_UVALUE = userval
Upon return from the procedure, userval contains the user value. Note that userval did not have to be defined before the call to WIDGET_CONTROL.
PLOT, [X,] Y [, /DATA | , /DEVICE | , /NORMAL]
In this example, you can choose either DATA, DEVICE, or NORMAL, but not more than one. An example of a valid statement is:
PLOT, SIN(A), /DEVICE